<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Denzel - Grid —— CSS网格布局初探</title>
    <meta name="description" content="前端笔记">
    <meta name="keywords" content="web前端,HTML5,CSS3,Javascript,SVG,canvas">
  <meta name="anthor" content="Denzel">
  <meta name="theme-color" content="#3eaf7c">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="msapplication-TileImage" content="/icons/msapplication-icon-144x144.png">
  <meta name="msapplication-TileColor" content="#000000">
  <link rel="icon" href="/blog/vuepress/logo.png">
  <link rel="manifest" href="/blog/vuepress/manifest.json">
  <link rel="apple-touch-icon" href="/blog/vuepress/icons/apple-touch-icon-152x152.png">
  <link rel="mask-icon" href="/blog/vuepress/icons/safari-pinned-tab.svg" color="#3eaf7c">
    
    <link rel="preload" href="/blog/vuepress/assets/css/0.styles.d4f29607.css" as="style"><link rel="preload" href="/blog/vuepress/assets/js/app.15770e34.js" as="script"><link rel="preload" href="/blog/vuepress/assets/js/50.31189263.js" as="script"><link rel="preload" href="/blog/vuepress/assets/js/63.9ac2b61d.js" as="script"><link rel="preload" href="/blog/vuepress/assets/js/65.923a8d15.js" as="script"><link rel="prefetch" href="/blog/vuepress/assets/js/46.59c0ece7.js"><link rel="prefetch" href="/blog/vuepress/assets/js/1.05e4270f.js"><link rel="prefetch" href="/blog/vuepress/assets/js/2.ace739f7.js"><link rel="prefetch" href="/blog/vuepress/assets/js/3.636e5a79.js"><link rel="prefetch" href="/blog/vuepress/assets/js/4.7a55aa4b.js"><link rel="prefetch" href="/blog/vuepress/assets/js/5.b56b0573.js"><link rel="prefetch" href="/blog/vuepress/assets/js/6.e9a3fbc8.js"><link rel="prefetch" href="/blog/vuepress/assets/js/7.aa46c47d.js"><link rel="prefetch" href="/blog/vuepress/assets/js/8.a9288ac6.js"><link rel="prefetch" href="/blog/vuepress/assets/js/9.b9f8dec6.js"><link rel="prefetch" href="/blog/vuepress/assets/js/10.3e2ea470.js"><link rel="prefetch" href="/blog/vuepress/assets/js/11.4d115f98.js"><link rel="prefetch" href="/blog/vuepress/assets/js/12.c97cf4d0.js"><link rel="prefetch" href="/blog/vuepress/assets/js/13.1e0cf594.js"><link rel="prefetch" href="/blog/vuepress/assets/js/14.bab9026a.js"><link rel="prefetch" href="/blog/vuepress/assets/js/15.1a24cffe.js"><link rel="prefetch" href="/blog/vuepress/assets/js/16.e9995850.js"><link rel="prefetch" href="/blog/vuepress/assets/js/17.86a1f7d2.js"><link rel="prefetch" href="/blog/vuepress/assets/js/18.c32400c4.js"><link rel="prefetch" href="/blog/vuepress/assets/js/19.9f99887c.js"><link rel="prefetch" href="/blog/vuepress/assets/js/20.82f0c2f9.js"><link rel="prefetch" href="/blog/vuepress/assets/js/21.7f5c223d.js"><link rel="prefetch" href="/blog/vuepress/assets/js/22.acf9934c.js"><link rel="prefetch" href="/blog/vuepress/assets/js/23.20d8e817.js"><link rel="prefetch" href="/blog/vuepress/assets/js/24.acf27379.js"><link rel="prefetch" href="/blog/vuepress/assets/js/25.20165510.js"><link rel="prefetch" href="/blog/vuepress/assets/js/26.83a2ddc3.js"><link rel="prefetch" href="/blog/vuepress/assets/js/27.33276a04.js"><link rel="prefetch" href="/blog/vuepress/assets/js/28.e320efab.js"><link rel="prefetch" href="/blog/vuepress/assets/js/29.3fd92c30.js"><link rel="prefetch" href="/blog/vuepress/assets/js/30.2bc84d43.js"><link rel="prefetch" href="/blog/vuepress/assets/js/31.d70ed500.js"><link rel="prefetch" href="/blog/vuepress/assets/js/32.e7a0f8e1.js"><link rel="prefetch" href="/blog/vuepress/assets/js/33.c48ee70b.js"><link rel="prefetch" href="/blog/vuepress/assets/js/34.8ad03d1b.js"><link rel="prefetch" href="/blog/vuepress/assets/js/35.5bdb3994.js"><link rel="prefetch" href="/blog/vuepress/assets/js/36.a25f926e.js"><link rel="prefetch" href="/blog/vuepress/assets/js/37.7515cfbb.js"><link rel="prefetch" href="/blog/vuepress/assets/js/38.99347371.js"><link rel="prefetch" href="/blog/vuepress/assets/js/39.3481fc62.js"><link rel="prefetch" href="/blog/vuepress/assets/js/40.bc709734.js"><link rel="prefetch" href="/blog/vuepress/assets/js/41.e1e0a3bf.js"><link rel="prefetch" href="/blog/vuepress/assets/js/42.762b61b0.js"><link rel="prefetch" href="/blog/vuepress/assets/js/43.8f0b2d6c.js"><link rel="prefetch" href="/blog/vuepress/assets/js/44.2a0a4ee0.js"><link rel="prefetch" href="/blog/vuepress/assets/js/45.baf7ed60.js"><link rel="prefetch" href="/blog/vuepress/assets/js/47.11a8720a.js"><link rel="prefetch" href="/blog/vuepress/assets/js/48.e0bf8b54.js"><link rel="prefetch" href="/blog/vuepress/assets/js/49.c96c4011.js"><link rel="prefetch" href="/blog/vuepress/assets/js/51.766a8294.js"><link rel="prefetch" href="/blog/vuepress/assets/js/52.26b971fd.js"><link rel="prefetch" href="/blog/vuepress/assets/js/53.0cfbd708.js"><link rel="prefetch" href="/blog/vuepress/assets/js/54.bdc15c87.js"><link rel="prefetch" href="/blog/vuepress/assets/js/55.fea285a9.js"><link rel="prefetch" href="/blog/vuepress/assets/js/56.e030a6b2.js"><link rel="prefetch" href="/blog/vuepress/assets/js/57.bd168a1e.js"><link rel="prefetch" href="/blog/vuepress/assets/js/58.636557fa.js"><link rel="prefetch" href="/blog/vuepress/assets/js/59.5d1d0ce6.js"><link rel="prefetch" href="/blog/vuepress/assets/js/60.0b779f92.js"><link rel="prefetch" href="/blog/vuepress/assets/js/61.4ec3f2eb.js"><link rel="prefetch" href="/blog/vuepress/assets/js/62.8f70f114.js"><link rel="prefetch" href="/blog/vuepress/assets/js/64.c028fad5.js"><link rel="prefetch" href="/blog/vuepress/assets/js/66.73db652e.js"><link rel="prefetch" href="/blog/vuepress/assets/js/67.1a91446d.js"><link rel="prefetch" href="/blog/vuepress/assets/js/68.e5a12a42.js"><link rel="prefetch" href="/blog/vuepress/assets/js/69.6ddcb882.js"><link rel="prefetch" href="/blog/vuepress/assets/js/70.ceb70d85.js"><link rel="prefetch" href="/blog/vuepress/assets/js/71.a804ef40.js"><link rel="prefetch" href="/blog/vuepress/assets/js/72.f1c4098c.js"><link rel="prefetch" href="/blog/vuepress/assets/js/73.2f28b842.js"><link rel="prefetch" href="/blog/vuepress/assets/js/74.571c2ab1.js"><link rel="prefetch" href="/blog/vuepress/assets/js/75.f365c2a1.js"><link rel="prefetch" href="/blog/vuepress/assets/js/76.0916a3cd.js"><link rel="prefetch" href="/blog/vuepress/assets/js/77.469aed17.js"><link rel="prefetch" href="/blog/vuepress/assets/js/78.02cdd59d.js"><link rel="prefetch" href="/blog/vuepress/assets/js/79.44d7f95c.js"><link rel="prefetch" href="/blog/vuepress/assets/js/80.4ca072f1.js"><link rel="prefetch" href="/blog/vuepress/assets/js/81.d9239a49.js"><link rel="prefetch" href="/blog/vuepress/assets/js/82.b09096b2.js"><link rel="prefetch" href="/blog/vuepress/assets/js/83.f4bc8a9b.js"><link rel="prefetch" href="/blog/vuepress/assets/js/84.1ffe6969.js"><link rel="prefetch" href="/blog/vuepress/assets/js/85.44e980f9.js"><link rel="prefetch" href="/blog/vuepress/assets/js/86.c8579ac0.js"><link rel="prefetch" href="/blog/vuepress/assets/js/87.cd49f324.js"><link rel="prefetch" href="/blog/vuepress/assets/js/88.3851b6ff.js"><link rel="prefetch" href="/blog/vuepress/assets/js/89.b05297be.js"><link rel="prefetch" href="/blog/vuepress/assets/js/90.c1e3263e.js"><link rel="prefetch" href="/blog/vuepress/assets/js/91.b493a1bb.js"><link rel="prefetch" href="/blog/vuepress/assets/js/92.80ab06fd.js"><link rel="prefetch" href="/blog/vuepress/assets/js/93.c6ca00b3.js"><link rel="prefetch" href="/blog/vuepress/assets/js/94.e993d310.js"><link rel="prefetch" href="/blog/vuepress/assets/js/95.8e19a7ed.js">
    <link rel="stylesheet" href="/blog/vuepress/assets/css/0.styles.d4f29607.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div><a href="/blog/vuepress/" class="home-link router-link-active"><img src="/blog/vuepress/hero.png" class="logo"><span class="site-name can-hide">
      Denzel
    </span></a><div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""><!----></div><nav class="nav-links can-hide"><div class="nav-item"><a href="/blog/vuepress/js/" class="nav-link">JS</a></div><div class="nav-item"><a href="/blog/vuepress/css/" class="nav-link router-link-active">CSS</a></div><div class="nav-item"><a href="/blog/vuepress/html/" class="nav-link">HTML</a></div><div class="nav-item"><a href="/blog/vuepress/else/" class="nav-link">其他</a></div><div class="nav-item"><a href="/blog/vuepress/study/" class="nav-link">study</a></div><a href="https://github.com/xiaotianxia" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav></div></header><div class="sidebar-mask"></div><div class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/blog/vuepress/js/" class="nav-link">JS</a></div><div class="nav-item"><a href="/blog/vuepress/css/" class="nav-link router-link-active">CSS</a></div><div class="nav-item"><a href="/blog/vuepress/html/" class="nav-link">HTML</a></div><div class="nav-item"><a href="/blog/vuepress/else/" class="nav-link">其他</a></div><div class="nav-item"><a href="/blog/vuepress/study/" class="nav-link">study</a></div><a href="https://github.com/xiaotianxia" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav><ul class="sidebar-links"><li><div class="sidebar-group first"><p class="sidebar-heading open"><span>CSS</span><!----></p><ul class="sidebar-group-items"><li><a href="/blog/vuepress/css/" class="sidebar-link">目录</a></li><li><a href="/blog/vuepress/css/svg_path_animation.html" class="sidebar-link">SVG轻松实现路径动画</a></li><li><a href="/blog/vuepress/css/clip_path.html" class="sidebar-link">CSS中的图像处理 —— clip-path</a></li><li><a href="/blog/vuepress/css/columns.html" class="sidebar-link">Columns —— CSS多栏布局</a></li><li><a href="/blog/vuepress/css/grid_layout.html" class="active sidebar-link">Grid —— CSS网格布局初探</a></li><li><a href="/blog/vuepress/css/styled_switch.html" class="sidebar-link">radio和checkbox的自定义样式</a></li><li><a href="/blog/vuepress/css/use_of_checkbox.html" class="sidebar-link">checkbox的应用</a></li></ul></div></li></ul></div><div class="page"><div class="content"><h1 id="grid-——-css网格布局初探"><a href="#grid-——-css网格布局初探" aria-hidden="true" class="header-anchor">#</a> Grid —— CSS网格布局初探</h1><p><a href="https://denzel.netlify.com/css/grid_layout.html?_=7654323456782357" target="_blank" rel="noopener noreferrer">原文链接</a></p><h2 id="前言"><a href="#前言" aria-hidden="true" class="header-anchor">#</a> 前言</h2><p>CSS网格布局是CSS中最强大的布局系统。 这是一个二维系统，这意味着它可以同时处理列和行，
不像flexbox那样主要是一维系统。 你可以通过将CSS规则应用于父元素（网格容器）
和该元素的子元素（网格元素）来使用网格布局。</p><p>通过网格布局和媒体查询的结合，不需要修改任何文档结构就可以重新排列元素布局的顺序，达到理想的布局效果。</p><p>下文中可点击”点击展开“查看具体代码及效果，可以点击“show in codepen”跳转到codepen自行调试，如没有，请点击<a href="https://denzel.netlify.com/css/grid_layout.html?_=7654323456782357" target="_blank" rel="noopener noreferrer">原文链接</a>查看原文。</p><p>先看一个例子：
<img src="http://pn4meizzc.bkt.clouddn.com/bloggrid002.png" alt="demo">
这种布局已经司空见惯了。我们看用grid的话，可以有哪些骚操作：</p><pre class="language-html"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>grid<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>item header<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>header<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>item content<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>content<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>item sidebar<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>sidebar<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>item footer<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>footer<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
</code></pre><pre class="language-css"><code><span class="token selector">.grid</span> <span class="token punctuation">{</span>
    <span class="token property">display</span><span class="token punctuation">:</span> grid<span class="token punctuation">;</span>
    <span class="token property">grid-gap</span><span class="token punctuation">:</span> 5px<span class="token punctuation">;</span>
    <span class="token property">height</span><span class="token punctuation">:</span> 400px<span class="token punctuation">;</span>
    <span class="token property">grid-template-areas</span><span class="token punctuation">:</span> <span class="token string">&quot;header  header&quot;</span>
                         <span class="token string">&quot;content sidebar&quot;</span> 
                         <span class="token string">&quot;footer  footer&quot;</span><span class="token punctuation">;</span>
    <span class="token property">grid-template-columns</span><span class="token punctuation">:</span> 1fr 100px<span class="token punctuation">;</span>
    <span class="token property">grid-template-rows</span><span class="token punctuation">:</span> 80px 1fr 80px<span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token selector">.header</span> <span class="token punctuation">{</span>
    <span class="token property">grid-area</span><span class="token punctuation">:</span> header<span class="token punctuation">;</span>
    <span class="token property">background-color</span><span class="token punctuation">:</span> #009688<span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token selector">.content</span> <span class="token punctuation">{</span>
    <span class="token property">grid-area</span><span class="token punctuation">:</span> content
<span class="token punctuation">}</span>

<span class="token selector">.sidebar</span> <span class="token punctuation">{</span>
    <span class="token property">grid-area</span><span class="token punctuation">:</span> sidebar<span class="token punctuation">;</span>
    <span class="token property">background-color</span><span class="token punctuation">:</span> #ff5722<span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token selector">.footer</span> <span class="token punctuation">{</span>
    <span class="token property">grid-area</span><span class="token punctuation">:</span> footer<span class="token punctuation">;</span>
    <span class="token property">background</span><span class="token punctuation">:</span> #9c27b0<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre><div class="spreadown-wrapper" data-v-ba9b4902><div class="spreadown-content" data-v-ba9b4902><iframe height="350" scrolling="no" title="demo" src="//codepen.io/_tianxia/embed/QxYqLm/?height=350&amp;theme-id=33504&amp;default-tab=result&amp;embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="allowfullscreen" style="width:100%;" data-v-ba9b4902>See the Pen <a href="https://codepen.io/_tianxia/pen/QxYqLm/" data-v-ba9b4902>demo</a> by Denzel (<a href="https://codepen.io/_tianxia" data-v-ba9b4902>@_tianxia</a>) on <a href="https://codepen.io" data-v-ba9b4902>CodePen</a>.</iframe><div class="codepen-wrapper"><a href="https://codepen.io/_tianxia/pen/QxYqLm" target="_blank" class="el-button el-button--primary is-plain">show in codepen <i class="el-icon-d-arrow-right"></i></a></div></div><div class="spreadown-trigger" data-v-ba9b4902><i class="el-icon-arrow-right" data-v-ba9b4902></i><span class="text" style="display:;" data-v-ba9b4902>点击展开</span><span class="text" style="display:none;" data-v-ba9b4902>点击隐藏</span></div></div><h2 id="几个概念"><a href="#几个概念" aria-hidden="true" class="header-anchor">#</a> 几个概念</h2><h3 id="网格容器-grid-container"><a href="#网格容器-grid-container" aria-hidden="true" class="header-anchor">#</a> 网格容器(Grid Container)</h3><p>顾名思义，真个望各位布局的容器，所有网格项目的父元素，例如上面例子中.grid。</p><h3 id="网格项目-grid-item"><a href="#网格项目-grid-item" aria-hidden="true" class="header-anchor">#</a> 网格项目(Grid Item)</h3><p>网格容器里的子元素(直接子元素)，上例中的.item。</p><h3 id="网格线-grid-line"><a href="#网格线-grid-line" aria-hidden="true" class="header-anchor">#</a> 网格线(Grid Line)</h3><p>简单理解，就是网格元素之间的缝隙。它们既可以是垂直的，也可以是水平的，并位于行或列的任一侧。
<img src="http://pn4meizzc.bkt.clouddn.com/grid003.jpg" alt="demo"></p><h3 id="网格轨道-grid-track"><a href="#网格轨道-grid-track" aria-hidden="true" class="header-anchor">#</a> 网格轨道(Grid Track)</h3><p>两个相邻网格线之间的空间。 可以把它们想象成网格的列或行。
<img src="http://pn4meizzc.bkt.clouddn.com/grid004.jpg" alt="demo"></p><h3 id="网格单元-grid-cell"><a href="#网格单元-grid-cell" aria-hidden="true" class="header-anchor">#</a> 网格单元(Grid Cell)</h3><p>两个相邻的行和两个相邻的列网格线之间的空间。它是网格的一个“单元”。
<img src="http://pn4meizzc.bkt.clouddn.com/grid005.jpg" alt="demo"></p><h3 id="网格区域-grid-area"><a href="#网格区域-grid-area" aria-hidden="true" class="header-anchor">#</a> 网格区域(Grid Area)</h3><p>四个网格线包围的总空间。 网格区域可以由任意数量的网格单元组成。
<img src="http://pn4meizzc.bkt.clouddn.com/grid006.jpg" alt="demo"></p><h2 id="属性列表"><a href="#属性列表" aria-hidden="true" class="header-anchor">#</a> 属性列表</h2><h3 id="网格容器"><a href="#网格容器" aria-hidden="true" class="header-anchor">#</a> 网格容器</h3><ul><li>display</li><li>grid</li><li>grid-template</li><li>grid-template-columns</li><li>grid-template-rows</li><li>grid-template-areas</li><li>grid-gap(grid-column-gap/grid-row-gap)</li><li>grid-auto-flow</li><li>grid-auto-columns</li><li>grid-auto-rows</li><li>justify-items</li><li>align-items</li><li>justify-content</li><li>align-content</li></ul><h3 id="网格项目"><a href="#网格项目" aria-hidden="true" class="header-anchor">#</a> 网格项目</h3><ul><li>grid-column(grid-column-start/grid-column-end)</li><li>grid-row(grid-row-start/grid-row-end)</li><li>grid-area</li><li>justify-self</li><li>align-self</li></ul><p>下面我们一起详细地学习这些属性——</p><h2 id="display"><a href="#display" aria-hidden="true" class="header-anchor">#</a> display</h2><pre class="language-css"><code><span class="token selector">.grid</span> <span class="token punctuation">{</span>
    <span class="token property">display</span><span class="token punctuation">:</span> grid | inline-grid | subgrid<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre><ul><li><strong>grid</strong> – 生成一个块级(block-level)网格</li><li><strong>inline-grid</strong> – 生成一个行级(inline-level)网格</li><li><strong>subgrid</strong> – 如果你的 grid container 本身就是一个 grid item（即,嵌套网格），你可以使用这个属性来表示你想从它的父节点获取它的行/列的大小，而不是指定它自己的大小。</li></ul><h2 id="grid-template-columns-grid-template-rows"><a href="#grid-template-columns-grid-template-rows" aria-hidden="true" class="header-anchor">#</a> grid-template-columns / grid-template-rows</h2><pre class="language-css"><code><span class="token selector">.grid</span> <span class="token punctuation">{</span>
    <span class="token property">grid-template-columns</span><span class="token punctuation">:</span> &lt;track-size&gt; ... | &lt;line-name&gt; &lt;track-size&gt; ...<span class="token punctuation">;</span>
    <span class="token property">grid-template-rows</span><span class="token punctuation">:</span> &lt;track-size&gt; ... | &lt;line-name&gt; &lt;track-size&gt; ...<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre><p>用空格分隔的值来定义网格的列和行，值表示的是轨道大小。
如果轨道值之间有line name，表示自定义的网格线名称，如果没有，系统会自动分配从1开始递增的数字名称。</p><h3 id="轨道值"><a href="#轨道值" aria-hidden="true" class="header-anchor">#</a> 轨道值</h3><p>任何非负值，长度可以是px、%、em等长度单位的值。
如：</p><pre class="language-css"><code><span class="token property">grid-template-columns</span><span class="token punctuation">:</span> 100px 30% 200px<span class="token punctuation">;</span>
<span class="token property">grid-template-rows</span><span class="token punctuation">:</span> 50px 100px<span class="token punctuation">;</span>
</code></pre><p><img src="http://pn4meizzc.bkt.clouddn.com/grid010.png" alt="demo"></p><div class="spreadown-wrapper" data-v-ba9b4902><div class="spreadown-content" data-v-ba9b4902><iframe height="325" scrolling="no" title="1" src="//codepen.io/_tianxia/embed/vrbJPG/?height=325&amp;theme-id=33504&amp;default-tab=result&amp;embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="allowfullscreen" style="width:100%;" data-v-ba9b4902>See the Pen <a href="https://codepen.io/_tianxia/pen/vrbJPG/" data-v-ba9b4902>1</a> by Denzel (<a href="https://codepen.io/_tianxia" data-v-ba9b4902>@_tianxia</a>) on <a href="https://codepen.io" data-v-ba9b4902>CodePen</a>.</iframe><div class="codepen-wrapper"><a href="https://codepen.io/_tianxia/pen/vrbJPG" target="_blank" class="el-button el-button--primary is-plain">show in codepen <i class="el-icon-d-arrow-right"></i></a></div></div><div class="spreadown-trigger" data-v-ba9b4902><i class="el-icon-arrow-right" data-v-ba9b4902></i><span class="text" style="display:;" data-v-ba9b4902>点击展开</span><span class="text" style="display:none;" data-v-ba9b4902>点击隐藏</span></div></div><p>定义了一个2行3列的网格，第二列占据30%父元素宽度。</p><pre class="language-css"><code><span class="token property">grid-template-columns</span><span class="token punctuation">:</span> 100px 2fr 1fr<span class="token punctuation">;</span>
<span class="token property">grid-template-rows</span><span class="token punctuation">:</span> 50px 100px<span class="token punctuation">;</span>
</code></pre><p><img src="http://pn4meizzc.bkt.clouddn.com/grid011.png" alt="demo"></p><div class="spreadown-wrapper" data-v-ba9b4902><div class="spreadown-content" data-v-ba9b4902><iframe height="330" scrolling="no" title="2" src="//codepen.io/_tianxia/embed/oymOLJ/?height=330&amp;theme-id=33504&amp;default-tab=result&amp;embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="allowfullscreen" style="width:100%;" data-v-ba9b4902>See the Pen <a href="https://codepen.io/_tianxia/pen/oymOLJ/" data-v-ba9b4902>2</a> by Denzel (<a href="https://codepen.io/_tianxia" data-v-ba9b4902>@_tianxia</a>) on <a href="https://codepen.io" data-v-ba9b4902>CodePen</a>.</iframe><div class="codepen-wrapper"><a href="https://codepen.io/_tianxia/pen/oymOLJ" target="_blank" class="el-button el-button--primary is-plain">show in codepen <i class="el-icon-d-arrow-right"></i></a></div></div><div class="spreadown-trigger" data-v-ba9b4902><i class="el-icon-arrow-right" data-v-ba9b4902></i><span class="text" style="display:;" data-v-ba9b4902>点击展开</span><span class="text" style="display:none;" data-v-ba9b4902>点击隐藏</span></div></div><p>fr单位可以创建一个弹性的网格轨道。这个例子中，网格容器的列分成了100px和3等份（1 + 2 = 3），每一份（1fr）是网格容器宽度的三分之一。所以第二个item和第三个item的宽度分别是网格容器宽度的三分之二和三分之一。</p><p>如果定义中包含重复的部分，则可以使用repeat()方法来简化写法：</p><pre class="language-css"><code><span class="token property">grid-template-columns</span><span class="token punctuation">:</span> <span class="token function">repeat</span><span class="token punctuation">(</span>2, 100px 1fr<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre><p>参数1是可以是重复的次数，参数2是重复的内容。</p><div class="spreadown-wrapper" data-v-ba9b4902><div class="spreadown-content" data-v-ba9b4902><iframe height="300" scrolling="no" title="3" src="//codepen.io/_tianxia/embed/GGzLbj/?height=300&amp;theme-id=33504&amp;default-tab=result&amp;embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="allowfullscreen" style="width:100%;" data-v-ba9b4902>See the Pen <a href="https://codepen.io/_tianxia/pen/GGzLbj/" data-v-ba9b4902>3</a> by Denzel (<a href="https://codepen.io/_tianxia" data-v-ba9b4902>@_tianxia</a>) on <a href="https://codepen.io" data-v-ba9b4902>CodePen</a>.</iframe><div class="codepen-wrapper"><a href="https://codepen.io/_tianxia/pen/GGzLbj" target="_blank" class="el-button el-button--primary is-plain">show in codepen <i class="el-icon-d-arrow-right"></i></a></div></div><div class="spreadown-trigger" data-v-ba9b4902><i class="el-icon-arrow-right" data-v-ba9b4902></i><span class="text" style="display:;" data-v-ba9b4902>点击展开</span><span class="text" style="display:none;" data-v-ba9b4902>点击隐藏</span></div></div><p>参数1也可以是auto-fill和auto-fit。</p><p>auto-fill创建了许多与网格容器相匹配的轨道，而不会导致网格溢出。</p><p>auto-fit与auto-fill类似，只是在网格项放置之后，它只会在需要时创建尽可能多的轨道，而重复的空轨道会堆叠在一起（合并）。</p><p>对于同样的四个项目的结构，二者的区别见下图：</p><p>grid-template-columns: repeat(auto-fill, 100px);效果着这样婶儿的：
<img src="http://pn4meizzc.bkt.clouddn.com/grid019.gif" alt="demo"></p><p>grid-template-columns: repeat(auto-fill, 100px);效果是这样婶儿的：
<img src="http://pn4meizzc.bkt.clouddn.com/grid020.gif" alt="demo"></p><p>具体有什么用？😰 额。。。我也不太清楚，这里先不深究了。</p><h3 id="minmax"><a href="#minmax" aria-hidden="true" class="header-anchor">#</a> minmax</h3><p>grid-template-columns/rows的参数还可以使用minmax函数，具体怎么使用可以看这里<a href="https://www.w3cplus.com/css3/how-the-minmax-function-works.html" target="_blank" rel="noopener noreferrer">minmax()函数如何工作</a></p><h2 id="grid-gap"><a href="#grid-gap" aria-hidden="true" class="header-anchor">#</a> grid-gap</h2><pre class="language-css"><code><span class="token selector">.grid</span> <span class="token punctuation">{</span>
    <span class="token property">grid-gap</span><span class="token punctuation">:</span> &lt;grid-row-gap&gt; &lt;grid-column-gap&gt;<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre><p>这个简单，是grid-column-gap和grid-row-gap的缩写形式，分别定义列与列、行与行之间的间隙。上面的例子已经用到了。</p><h2 id="grid-column-grid-row"><a href="#grid-column-grid-row" aria-hidden="true" class="header-anchor">#</a> grid-column / grid-row</h2><p>grid-column：grid-column-start / grid-column-end的缩写</p><p>grid-row：grid-row-start / grid-row-end的缩写</p><p>可使用grid-column / grid-row来定义网格的大小(跨度)定位网格。定位我们一会再说，先看下如何定义网格的大小。
这类似于table的合并单元格(rowspan、colspan)，不同的是网格项数目并不会增减。</p><pre class="language-css"><code><span class="token property">grid-column</span><span class="token punctuation">:</span> span 2<span class="token punctuation">;</span>
<span class="token property">grid-row</span><span class="token punctuation">:</span> span 2<span class="token punctuation">;</span>
</code></pre><p><img src="http://pn4meizzc.bkt.clouddn.com/grid012.png" alt="demo"></p><div class="spreadown-wrapper" data-v-ba9b4902><div class="spreadown-content" data-v-ba9b4902><iframe height="370" scrolling="no" title="4" src="//codepen.io/_tianxia/embed/rKPgNo/?height=370&amp;theme-id=33504&amp;default-tab=result&amp;embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="allowfullscreen" style="width:100%;" data-v-ba9b4902>See the Pen <a href="https://codepen.io/_tianxia/pen/rKPgNo/" data-v-ba9b4902>4</a> by Denzel (<a href="https://codepen.io/_tianxia" data-v-ba9b4902>@_tianxia</a>) on <a href="https://codepen.io" data-v-ba9b4902>CodePen</a>.</iframe><div class="codepen-wrapper"><a href="https://codepen.io/_tianxia/pen/rKPgNo" target="_blank" class="el-button el-button--primary is-plain">show in codepen <i class="el-icon-d-arrow-right"></i></a></div></div><div class="spreadown-trigger" data-v-ba9b4902><i class="el-icon-arrow-right" data-v-ba9b4902></i><span class="text" style="display:;" data-v-ba9b4902>点击展开</span><span class="text" style="display:none;" data-v-ba9b4902>点击隐藏</span></div></div><h2 id="通过网格线名称定位"><a href="#通过网格线名称定位" aria-hidden="true" class="header-anchor">#</a> 通过网格线名称定位</h2><pre class="language-css"><code><span class="token property">grid-column</span><span class="token punctuation">:</span> 2 / 4<span class="token punctuation">;</span>
<span class="token property">grid-row</span><span class="token punctuation">:</span> 3 / 5<span class="token punctuation">;</span>
</code></pre><p>相当于</p><pre class="language-css"><code><span class="token property">grid-column-start</span><span class="token punctuation">:</span> 2<span class="token punctuation">;</span>
<span class="token property">grid-column-end</span><span class="token punctuation">:</span> 4<span class="token punctuation">;</span>
<span class="token property">grid-row-start</span><span class="token punctuation">:</span> 3<span class="token punctuation">;</span>
<span class="token property">grid-row-end</span><span class="token punctuation">:</span> 5<span class="token punctuation">;</span>
</code></pre><p>也相当于</p><pre class="language-css"><code><span class="token property">grid-column</span><span class="token punctuation">:</span> 2 / 4<span class="token punctuation">;</span>
<span class="token property">grid-row</span><span class="token punctuation">:</span> 3 / 5<span class="token punctuation">;</span>
</code></pre><p>而</p><pre class="language-css"><code><span class="token property">grid-column</span><span class="token punctuation">:</span> 2<span class="token punctuation">;</span>
<span class="token property">grid-row</span><span class="token punctuation">:</span> 3<span class="token punctuation">;</span>
</code></pre><p>相当于</p><pre class="language-css"><code><span class="token property">grid-column-start</span><span class="token punctuation">:</span> 2<span class="token punctuation">;</span>
<span class="token property">grid-column-end</span><span class="token punctuation">:</span> auto<span class="token punctuation">;</span>
<span class="token property">grid-row-start</span><span class="token punctuation">:</span> 3<span class="token punctuation">;</span>
<span class="token property">grid-row-end</span><span class="token punctuation">:</span> auto<span class="token punctuation">;</span>
</code></pre><p><img src="http://pn4meizzc.bkt.clouddn.com/grid014.png" alt="demo"></p><div class="spreadown-wrapper" data-v-ba9b4902><div class="spreadown-content" data-v-ba9b4902><iframe height="400" scrolling="no" title="6" src="//codepen.io/_tianxia/embed/ERrzLa/?height=400&amp;theme-id=33504&amp;default-tab=result&amp;embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="allowfullscreen" style="width:100%;" data-v-ba9b4902>See the Pen <a href="https://codepen.io/_tianxia/pen/ERrzLa/" data-v-ba9b4902>6</a> by Denzel (<a href="https://codepen.io/_tianxia" data-v-ba9b4902>@_tianxia</a>) on <a href="https://codepen.io" data-v-ba9b4902>CodePen</a>.</iframe><div class="codepen-wrapper"><a href="https://codepen.io/_tianxia/pen/ERrzLa" target="_blank" class="el-button el-button--primary is-plain">show in codepen <i class="el-icon-d-arrow-right"></i></a></div></div><div class="spreadown-trigger" data-v-ba9b4902><i class="el-icon-arrow-right" data-v-ba9b4902></i><span class="text" style="display:;" data-v-ba9b4902>点击展开</span><span class="text" style="display:none;" data-v-ba9b4902>点击隐藏</span></div></div><pre class="language-css"><code><span class="token property">grid-column</span><span class="token punctuation">:</span> 2 / span 2<span class="token punctuation">;</span>
<span class="token property">grid-row</span><span class="token punctuation">:</span> 3 / span 2<span class="token punctuation">;</span>
</code></pre><p><img src="http://pn4meizzc.bkt.clouddn.com/grid013.png" alt="demo"></p><div class="spreadown-wrapper" data-v-ba9b4902><div class="spreadown-content" data-v-ba9b4902><iframe height="400" scrolling="no" title="5" src="//codepen.io/_tianxia/embed/GGzavE/?height=400&amp;theme-id=33504&amp;default-tab=result&amp;embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="allowfullscreen" style="width:100%;" data-v-ba9b4902>See the Pen <a href="https://codepen.io/_tianxia/pen/GGzavE/" data-v-ba9b4902>5</a> by Denzel (<a href="https://codepen.io/_tianxia" data-v-ba9b4902>@_tianxia</a>) on <a href="https://codepen.io" data-v-ba9b4902>CodePen</a>.</iframe><div class="codepen-wrapper"><a href="https://codepen.io/_tianxia/pen/GGzavE" target="_blank" class="el-button el-button--primary is-plain">show in codepen <i class="el-icon-d-arrow-right"></i></a></div></div><div class="spreadown-trigger" data-v-ba9b4902><i class="el-icon-arrow-right" data-v-ba9b4902></i><span class="text" style="display:;" data-v-ba9b4902>点击展开</span><span class="text" style="display:none;" data-v-ba9b4902>点击隐藏</span></div></div><h2 id="通过网格区域定位"><a href="#通过网格区域定位" aria-hidden="true" class="header-anchor">#</a> 通过网格区域定位</h2><h3 id="grid-area"><a href="#grid-area" aria-hidden="true" class="header-anchor">#</a> grid-area</h3><p>grid-area: grid-row-start / grid-column-start / grid-row-end / grid-column-end的缩写，可以是默认的数字网格线名称，也可以是自定义的网格线名称，</p><p>还可以是<strong>一个</strong>具体的自定义的名称，见开头的例子：
给每个块定义grid-area名称，然后通过grid-template-areas定义块的布局。这种写法简单明了，一眼就能看出整体布局。</p><div class="spreadown-wrapper" data-v-ba9b4902><div class="spreadown-content" data-v-ba9b4902><iframe height="400" scrolling="no" title="7" src="//codepen.io/_tianxia/embed/dKaEjN/?height=400&amp;theme-id=33504&amp;default-tab=result&amp;embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="allowfullscreen" style="width:100%;" data-v-ba9b4902>See the Pen <a href="https://codepen.io/_tianxia/pen/dKaEjN/" data-v-ba9b4902>7</a> by Denzel (<a href="https://codepen.io/_tianxia" data-v-ba9b4902>@_tianxia</a>) on <a href="https://codepen.io" data-v-ba9b4902>CodePen</a>.</iframe><div class="codepen-wrapper"><a href="https://codepen.io/_tianxia/pen/dKaEjN" target="_blank" class="el-button el-button--primary is-plain">show in codepen <i class="el-icon-d-arrow-right"></i></a></div></div><div class="spreadown-trigger" data-v-ba9b4902><i class="el-icon-arrow-right" data-v-ba9b4902></i><span class="text" style="display:;" data-v-ba9b4902>点击展开</span><span class="text" style="display:none;" data-v-ba9b4902>点击隐藏</span></div></div><h2 id="隐式网格-implicit-grid"><a href="#隐式网格-implicit-grid" aria-hidden="true" class="header-anchor">#</a> 隐式网格(Implicit Grid)</h2><p>想象一下：网格容器中，我们定义了一个3行4列的网格，但是容器的直接子元素多余3×4=12个，那个多余的子元素该怎么安排呢。
css规定，没有显式地定义的网格项目(即显式网格外面的项目)会形成一个<strong>隐式网格</strong>。这一部分元素可通过grid-auto-columns、
grid-auto-rows和grid-auto-flow控制。</p><h2 id="grid-auto-columns-grid-auto-rows"><a href="#grid-auto-columns-grid-auto-rows" aria-hidden="true" class="header-anchor">#</a> grid-auto-columns / grid-auto-rows</h2><p>分别定义隐式网格列和行的尺寸。</p><div class="spreadown-wrapper" data-v-ba9b4902><div class="spreadown-content" data-v-ba9b4902><iframe height="400" scrolling="no" title="8" src="//codepen.io/_tianxia/embed/GGzVrR/?height=400&amp;theme-id=33504&amp;default-tab=result&amp;embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="allowfullscreen" style="width:100%;" data-v-ba9b4902>See the Pen <a href="https://codepen.io/_tianxia/pen/GGzVrR/" data-v-ba9b4902>8</a> by Denzel (<a href="https://codepen.io/_tianxia" data-v-ba9b4902>@_tianxia</a>) on <a href="https://codepen.io" data-v-ba9b4902>CodePen</a>.</iframe><div class="codepen-wrapper"><a href="https://codepen.io/_tianxia/pen/GGzVrR" target="_blank" class="el-button el-button--primary is-plain">show in codepen <i class="el-icon-d-arrow-right"></i></a></div></div><div class="spreadown-trigger" data-v-ba9b4902><i class="el-icon-arrow-right" data-v-ba9b4902></i><span class="text" style="display:;" data-v-ba9b4902>点击展开</span><span class="text" style="display:none;" data-v-ba9b4902>点击隐藏</span></div></div><h2 id="grid-auto-flow"><a href="#grid-auto-flow" aria-hidden="true" class="header-anchor">#</a> grid-auto-flow</h2><p>默认值是row，定义网格的展示方式：网格项目是按列的方式还是行的方式排列。</p><pre class="language-css"><code><span class="token selector">.grid</span> <span class="token punctuation">{</span>
  	<span class="token property">grid-auto-flow</span><span class="token punctuation">:</span> row | column | row dense | column dense
<span class="token punctuation">}</span>
</code></pre><div class="tip custom-block"><p class="custom-block-title">tip</p><p>可以给grid-auto-flow属性添加另外一个关键词dense(密集的)，这个属性值<strong>相当有用</strong>：系统会利用自动排列算法尽可能的填补空缺，
使布局变得密集。但这可能打乱元素原来的顺序，这也意味着它不能友好地反映文档流顺序，这一点对于一些用户而言并不总是有用的。</p></div><p>看下前后对比图：</p><p>前：<img src="http://pn4meizzc.bkt.clouddn.com/grid015.png" alt="demo"></p><p>后：<img src="http://pn4meizzc.bkt.clouddn.com/grid016.png" alt="demo"></p><div class="spreadown-wrapper" data-v-ba9b4902><div class="spreadown-content" data-v-ba9b4902><iframe height="511" scrolling="no" title="9" src="//codepen.io/_tianxia/embed/eKQNYm/?height=511&amp;theme-id=33504&amp;default-tab=result&amp;embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="allowfullscreen" style="width:100%;" data-v-ba9b4902>See the Pen <a href="https://codepen.io/_tianxia/pen/eKQNYm/" data-v-ba9b4902>9</a> by Denzel (<a href="https://codepen.io/_tianxia" data-v-ba9b4902>@_tianxia</a>) on <a href="https://codepen.io" data-v-ba9b4902>CodePen</a>.</iframe><div class="codepen-wrapper"><a href="https://codepen.io/_tianxia/pen/eKQNYm" target="_blank" class="el-button el-button--primary is-plain">show in codepen <i class="el-icon-d-arrow-right"></i></a></div></div><div class="spreadown-trigger" data-v-ba9b4902><i class="el-icon-arrow-right" data-v-ba9b4902></i><span class="text" style="display:;" data-v-ba9b4902>点击展开</span><span class="text" style="display:none;" data-v-ba9b4902>点击隐藏</span></div></div><h2 id="对齐相关"><a href="#对齐相关" aria-hidden="true" class="header-anchor">#</a> 对齐相关</h2><p>justify-items、justify-self指定<strong>网格项目</strong>沿着<strong>行</strong>轴对齐方式。</p><p>align-items、align-self指定<strong>网格项目</strong>沿着<strong>列</strong>轴对齐方式。</p><p>align-content指定<strong>网格轨道</strong>沿着<strong>行</strong>轴对齐方式；
justify-content指定<strong>网格轨道</strong>沿着<strong>列</strong>轴对齐方式。</p><p>他们所对应的值及具体表现形式，可参考<a href="https://drafts.csswg.org/css-align/" target="_blank" rel="noopener noreferrer">这里</a>，不再赘述了。</p><h2 id="浏览器调试"><a href="#浏览器调试" aria-hidden="true" class="header-anchor">#</a> 浏览器调试</h2><p>firefox里，可以通过设置显示网格的名称、行号等信息，点<a href="http://www.w3cplus.com/css/grid-inspector.html" target="_blank" rel="noopener noreferrer">这里</a>看详情，非常方便，
如下图：
<img src="http://pn4meizzc.bkt.clouddn.com/grid017.png" alt="demo"></p><div class="tip custom-block"><p class="custom-block-title">tip</p><p>从图中可以看出，grid-column/row-start/end是可以为负数的，正负值差别是，位置将从相反的方向开始。</p><p>这样看来*-end也是可以小于*-start的。</p></div><p>chrome的高一点版本(我的是67)，可以显示对应网格线，不知道能不能进一步设置？。。。
如下图：
<img src="http://pn4meizzc.bkt.clouddn.com/grid018.png" alt="demo">
但是chrome有一个<a href="https://github.com/ademilter/chrome-css-grid-highlighter" target="_blank" rel="noopener noreferrer">网格布局高亮插件</a>可以帮助到我们。</p><h2 id="总结"><a href="#总结" aria-hidden="true" class="header-anchor">#</a> 总结</h2><p>关于Grid布局，本文讲解的东西对于全民啊理解网格布局还只是杯水车薪，其中的好多细节都没有涉及到。
若发现有错误的地方，欢迎不吝指教！🙏</p><p>想要了解更多，推荐进<a href="http://www.w3cplus.com/blog/tags/355.html" target="_blank" rel="noopener noreferrer">这里</a>或者<a href="https://codepen.io/search/pens?q=CSS%20Grid%20Layout&page=1&order=popularity&depth=everything&show_forks=false" target="_blank" rel="noopener noreferrer">这里</a>的一些demo进一步学习。</p><h2 id="参考资料"><a href="#参考资料" aria-hidden="true" class="header-anchor">#</a> 参考资料</h2><ul><li><a href="https://medium.com/@purplecones/playing-with-css-grid-layout-a75836098370" target="_blank" rel="noopener noreferrer">Playing with css grid layout</a></li><li><a href="https://learncssgrid.com/" target="_blank" rel="noopener noreferrer">learn css grid</a></li><li><a href="http://www.w3cplus.com/blog/tags/355.html" target="_blank" rel="noopener noreferrer">grid入门</a></li><li><a href="http://blog.jirengu.com/?p=990" target="_blank" rel="noopener noreferrer">CSS 网格布局学习指南</a></li></ul></div><div class="wx-wrapper" data-v-0de8a4bf><p class="wx-txt" data-v-0de8a4bf>欢迎关注</p><img src="http://pn4meizzc.bkt.clouddn.com/wxqr.png" class="wx-img" data-v-0de8a4bf></div><div class="beg-wrapper" data-v-1f1af99c><a href="javascript:;" class="btn show" data-v-1f1af99c><img src="http://pn4meizzc.bkt.clouddn.com/blogshang_log.png" data-v-1f1af99c></a><p class="shang-txt" data-v-1f1af99c>赏不赏，看您心情</p><img src="http://pn4meizzc.bkt.clouddn.com/blogWechatIMG35.jpeg" class="shangImg" data-v-1f1af99c></div><!----><div class="content page-nav"><p class="inner"><span class="prev">
        ← <a href="/blog/vuepress/css/columns.html" class="prev">
          Columns —— CSS多栏布局
        </a></span><span class="next"><a href="/blog/vuepress/css/styled_switch.html">
          radio和checkbox的自定义样式
        </a> →
      </span></p></div></div></div></div>
    <script src="/blog/vuepress/assets/js/50.31189263.js" defer></script><script src="/blog/vuepress/assets/js/63.9ac2b61d.js" defer></script><script src="/blog/vuepress/assets/js/65.923a8d15.js" defer></script><script src="/blog/vuepress/assets/js/app.15770e34.js" defer></script>
  </body>
</html>
